package com.lau.dicttranslator.enums;

/**
 * 示例状态枚举
 */
public enum StatusEnum {
    ACTIVE(1, "启用"),
    INACTIVE(0, "禁用"),
    PENDING(2, "待审核");
    
    private final Integer code;
    private final String name;
    
    StatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }
    
    public Integer getCode() {
        return code;
    }
    
    public String getName() {
        return name;
    }
    
    /**
     * 根据code获取name
     */
    public static String getNameByCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (StatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status.getName();
            }
        }
        return null;
    }
} 